import Vue from 'vue'

import EventInfoWindow from './EventInfoWindow.vue'

const VueComp = Vue.extend(EventInfoWindow)
let instance ={}

const eventInfoWindow = {
    // 打开
    show(options) {
			console.log('options', options)
			instance[options.orderData[0].resourceId] = new VueComp({ propsData: options })
			let smallImgInfo = options.orderData[0]
			let id = 'event_' + smallImgInfo.longitude + '_' +smallImgInfo.latitude
			let dom = document.getElementById(id)
			const subdom = document.createElement('div')
			dom.appendChild(subdom)
			instance[options.orderData[0].resourceId].$mount(subdom)
    },

    // 关闭
    close() {
			Object.keys(instance).forEach((key) => {
				instance[key].$destroy()
			})
    }
}

export default eventInfoWindow
